global N;
global ERROR_TOL;
global EPOCHS;
global G;
global FALSE;

constants;

patterns = generatePatterns(N);
solutions = horzcat(FALSE, ones(1, power(2, N) - 1))';   % En un OR todas las salidas son 1 menos la primera que es 0 cuando todos son 0.
if G == 4
    s = ones(1,length(patterns(:,1))-power(2,N))*(-1);
    solutions = [solutions; s'];
end
weights = generateWeights(N+1);         % Hay que considerar el umbral tambi?n.
tolerance = ERROR_TOL;

wf = trainSimplePerceptron (patterns, weights, solutions, tolerance, EPOCHS);

for i = 1:power(2,N)
    disp('Pattern: ');
    disp(patterns(i,:));
    output = valPatterns(wf, patterns(i,:));
    disp('Output: ');
    disp(output);
end


